package cn.skcks.springboot02.pojo;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Component
@ConfigurationProperties(prefix = "person")
@Validated // JSR303 数据校验
public class Person {

//	@Email(message = "邮箱格式不合法")
//	@NotNull(message = "name 不能为空")
	@NotBlank
	private String name;
	private int age;
	private Boolean die;
	private Date both;
	private Map<String, Object> map;
	private List<Object> list;
	private Dog dog;

	public Person() {
	}

	public Person(String name, int age, Boolean die, Date both, Map<String, Object> map, List<Object> list, Dog dog) {
		this.name = name;
		this.age = age;
		this.die = die;
		this.both = both;
		this.map = map;
		this.list = list;
		this.dog = dog;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public Boolean getDie() {
		return die;
	}

	public void setDie(Boolean die) {
		this.die = die;
	}

	public Date getBoth() {
		return both;
	}

	public void setBoth(Date both) {
		this.both = both;
	}

	public Map<String, Object> getMap() {
		return map;
	}

	public void setMap(Map<String, Object> map) {
		this.map = map;
	}

	public List<Object> getList() {
		return list;
	}

	public void setList(List<Object> list) {
		this.list = list;
	}

	public Dog getDog() {
		return dog;
	}

	public void setDog(Dog dog) {
		this.dog = dog;
	}

	@Override
	public String toString() {
		return "Person{" +
				"name='" + name + '\'' +
				", age=" + age +
				", die=" + die +
				", both=" + both +
				", map=" + map +
				", list=" + list +
				", dog=" + dog +
				'}';
	}
}